<!-- 查看详情 -->
<template>
  <div id="dialog-container">
    <el-dialog v-dialogDrag title="数据信息" append-to-body :close-on-click-modal="false"
      :visible.sync="dialogVisible" @close="$emit('update:show', false)" :before-close="handleClose" :show="show" width="800px">
      <el-button size="small" type="primary" @click="getExcel()">导出</el-button>
      <h3 style="text-align: center;">人员任务完成及时率详情</h3>
      <br>
      <el-table :data="tableData" border size="">
        <el-table-column prop="task_no" align="center" label="任务单号" min-width="100"></el-table-column>
        <el-table-column prop="task_type" align="center" label="任务类型"></el-table-column>
        <el-table-column prop="expectCompleteTime" align="center" label="预计完成时间"></el-table-column>
        <el-table-column prop="auditTime" align="center" label="实际完成时间"></el-table-column>
        <el-table-column prop="timely" align="center" label="是否及时"></el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  import {
      getPersonCompletionRateInfor
  } from "service/task";
  export default {
    data() {
      return {
        dialogVisible: false,
        tableData: []
      }
    },
    props: {
      show: {
        type: Boolean,
        default: false,
      },
      modifyId:{
            type: String
      },
      dataEnd:{
          type: String
      },
      stDate:{
          type: String
      }
    },
    watch: {
      show() {
        getPersonCompletionRateInfor({
          acceptUid: this.modifyId,
          fromDate: this.dataEnd,
          toDate: this.stDate
        }).then(res => {
          this.tableData = res.data.result.list;
          // this.tableData.forEach(e=>{
          //   let type = "";
          //   if(e.task_type==1){
          //       type = "委托型";
          //   } 
          //   if(e.task_type==2){
          //       type = "生产型";
          //   } 
          //   if(e.task_type==3){
          //       type = "非WIP生产型";
          //   } 
          //   e.task_type=type;
          // })
        })
        this.dialogVisible = this.show;
      }
    },
    methods: {
      getExcel() {
        window.location.href= `${process.env.API_URL}` + "report/getPersonCompletionRateInforExcel?acceptUid=" + this.modifyId
         + "&startDate=" + this.dataEnd + "&endDate=" + this.stDate;
      },
      handleClose() { /* 关闭的时候更新状态值 */
        this.dialogVisible = false;
      }
    }
  }

</script>
